package prickworlds.gui;

/**
 * event class to tell an {@link ActionListener} if something happened
 * 
 * @author Faruk Acibal, Richard Dziambor, Christian Holzreuter, Nicolas Winkler
 * 
 */
public class ActionEvent {
	/**
	 * the {@link ActiveControl} that caused the event
	 */
	private ActiveControl source;

	/**
	 * params
	 */
	private int params;

	/**
	 * actionCommand, specified for the {@link ActiveControl}
	 */
	private String actionCommand;

	/**
	 * creates an {@link ActionEvent} caused by source
	 * 
	 * @param source
	 *            the {@link ActiveControl} that caused the event
	 */
	public ActionEvent(ActiveControl source) {
		this.source = source;
	}

	/**
	 * creates an {@link ActionEvent} caused by source
	 * 
	 * @param source
	 *            the {@link ActiveControl} that caused the event
	 * @param params
	 *            {@code int} value
	 * @param actionCommand
	 *            additional parameter
	 */
	public ActionEvent(ActiveControl source, int params, String actionCommand) {
		this.source = source;
		this.params = params;
		this.actionCommand = actionCommand;
	}

	/**
	 * returns the action command
	 * 
	 * @return the events action command
	 */
	public String getActionCommand() {
		return actionCommand;
	}

	/**
	 * returns {@code int} parameter
	 * 
	 * @return the events {@code int} parameter
	 */
	public int getParams() {
		return params;
	}

	/**
	 * returns the {@code ActiveControl} that caused the event
	 * 
	 * @return the {@code ActiveControl} that caused the event
	 */
	public ActiveControl getSource() {
		return source;
	}
}